package com.jacky.javafx.entities;


import com.jacky.javafx.enums.AppUserStateEnum;
import com.jacky.javafx.enums.GenderEnum;
import com.jacky.javafx.enums.UserGroupEnum;
import com.jacky.javafx.utils.DateTimeUtil;
import org.springframework.beans.BeanUtils;

public class AppUserViewModel {

    private Long id;

    private String loginName;

    private String password;

    private String openId;

    private String nickName;

    private String mobile;

    private String headPic;

    private String gender;

    private String userGroup;

    private String state;

    private String registryTime;

    public AppUserViewModel() {
    }

    public AppUserViewModel(AppUserEntity entity) {
        BeanUtils.copyProperties(entity, this);
        this.setGender(GenderEnum.findByCode(entity.getGender()).zh());
        this.setUserGroup(UserGroupEnum.findByCode(entity.getUserGroup()).zh());
        this.setState(AppUserStateEnum.findByCode(entity.getState()).zh());
        this.setRegistryTime(DateTimeUtil.defaultFormat(entity.getRegistryTime()));
    }

    public AppUserViewModel(Long id, String loginName, String password, String openId, String nickName, String mobile, String headPic, String gender, String userGroup, String state, String registryTime) {
        this.id = id;
        this.loginName = loginName;
        this.password = password;
        this.openId = openId;
        this.nickName = nickName;
        this.mobile = mobile;
        this.headPic = headPic;
        this.gender = gender;
        this.userGroup = userGroup;
        this.state = state;
        this.registryTime = registryTime;
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getHeadPic() {
        return headPic;
    }

    public void setHeadPic(String headPic) {
        this.headPic = headPic;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getUserGroup() {
        return userGroup;
    }

    public void setUserGroup(String userGroup) {
        this.userGroup = userGroup;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getRegistryTime() {
        return registryTime;
    }

    public void setRegistryTime(String registryTime) {
        this.registryTime = registryTime;
    }

    @Override
    public String toString() {
        return "AppUserViewModel{" +
                "id=" + id +
                ", loginName='" + loginName + '\'' +
                ", password='" + password + '\'' +
                ", openId='" + openId + '\'' +
                ", nickName='" + nickName + '\'' +
                ", mobile='" + mobile + '\'' +
                ", headPic='" + headPic + '\'' +
                ", gender='" + gender + '\'' +
                ", userGroup='" + userGroup + '\'' +
                ", state='" + state + '\'' +
                ", registryTime='" + registryTime + '\'' +
                '}';
    }
}
